#!/usr/bin/python
# -*- coding: UTF-8 -*-
# author: wangxiaoming 2021-11-16
# desc: thermal测试类

import enum
import unittest
import os
import time
import struct
from ctypes import *
from mainunit_common import *
from mainunit_api import *

class testself_lcd_drv(unittest.TestCase):
        
    def testself1_lcd_drv_value(self):
        print(f'\t==================================')
        expected=ECODE_OK
        valueset=c_int(0)
        
        ret = lcd_drv_init()
        print(f'\tstep. call api: lcd_drv_init, actual value={ret}, expected value={expected}')
        self.assertEqual(ret, expected)
        
        #close backligth first
        ret = lcd_drv_backlight_control(valueset)        
        print(f'\tstep. call api: lcd_drv_backlight_control, input param={valueset} actual value={ret}, expected value={expected}')		
        self.assertEqual(ret, expected)
        
        txt = sp_input(f"\n\tPLEASE CHCECK LCD BACKLIGHT AFTER PRESSING ANY KEY TO CONTINUE\n")        
        for i in [1,15,0,15,1,16,0,16]:
            valueset=c_int(i)
            ret = lcd_drv_backlight_control(valueset)        
            print(f'\tstep. call api: lcd_drv_backlight_control, input param={valueset} actual value={ret}, expected value={expected}')		
            self.assertEqual(ret, expected)
            time.sleep(1)
            
        ret = lcd_drv_uinit()
        print(f'\tstep. call api: lcd_drv_uinit, actual value={ret}, expected value={expected}')
        self.assertEqual(ret, expected)
        
        print('\t**********************************')    
